import { http } from './service.js'

export const addRecordFood = (params) => {
	console.log(params);
	return http.request({
		url: '/pad/record/feeding',
		method: 'POST',
		params: params
	})
}

export const getRecordFood = (params) => {
	return http.request({
		url: '/pad/record/feeding',
		method: 'GET',
		params: params
	})
}


export const addRecordPotty = (params) => {
	return http.request({
		url: '/pad/record/potty',
		method: 'POST',
		params: params
	})
}

export const getRecordPotty = (params) => {
	return http.request({
		url: '/pad/record/potty',
		method: 'GET',
		params: params
	})
}


export const addRecordTemperature = (params) => {
	return http.request({
		url: '/pad/record/temperature',
		method: 'POST',
		params: params
	})
}

export const getRecordTemperature = (params) => {
	return http.request({
		url: '/pad/record/temperature',
		method: 'GET',
		params: params
	})
}


export const addRecordSleep = (params) => {
	return http.request({
		url: '/pad/record/sleep',
		method: 'POST',
		params: params
	})
}

export const getRecordSleep = (params) => {
	return http.request({
		url: '/pad/record/sleep',
		method: 'GET',
		params: params
	})
}


export const addRecordHandover = (param) => {
	return http.request({
		url: '/pad/record/handover',
		method: 'POST',
		data: param
	})
}
export const addRecordMedication = (param) => {
	return http.request({
		url: '/pad/record/medication',
		method: 'POST',
		params: param
	})
}

export const getRecordHandover = (param) => {
	return http.request({
		url: '/pad/record/handover',
		method: 'GET',
		data: param
	})
}

export const uploadRecordImg = (formData, files) => {
	return http.upload('/pad/upload/record_img', {
		formData: formData,
		files: files
	})
}

export const uploadRecordImgByPath = (filePath) => {
	return http.upload('/pad/upload/record_img', {
		filePath: filePath,
		name: 'file',
		formData: {
			'recordType': 'handover'
		},
	})
}

export const uploadRecordSvgByPath = (filePath) => {
	return http.upload('/wx/api/upload/file', {
		filePath: filePath,
		name: 'file',
		formData: {
			'recordType': 'handover'
		},
	})
}

export const getDailyList = (classId, daily) => {
	console.log(classId)
	console.log(daily)
	return http.request({
		url: '/pad/record/daily/multiple',
		method: 'GET',
		params: {
			'classId': classId,
			'daily': daily,
			'pageNum': 0,
			'pageSize': 100,
		}
	})
}
//体温查询
export const getTemperatureList = (childId, daily) => {
	return http.request({
		url: '/pad/record/temperature/daily_records',
		method: 'GET',
		params: {
			'childId': childId,
			'daily': daily,
		}
	})
}

//饮食
export const getFeedingList = (childId, daily) => {
	return http.request({
		url: '/pad/record/feeding/daily_records',
		method: 'GET',
		params: {
			'childId': childId,
			'daily': daily,
		}
	})
}
//睡眠
export const getSleepList = (childId, daily) => {
	return http.request({
		url: '/pad/record/sleep/daily_records',
		method: 'GET',
		params: {
			'childId': childId,
			'daily': daily,
		}
	})
}
//药品交接
export const getHandoverList = (childId, daily) => {
	return http.request({
		url: '/pad/record/handover/daily_records',
		method: 'GET',
		params: {
			'childId': childId,
			'daily': daily,
		}
	})
}
export const getHandoverByDaily = (params) => {
	return http.request({
		url: '/pad/record/handover/v2_list',
		method: 'GET',
		params
	})
}
export const deleteHandover = (childId, id) => {
	return http.request({
		url: '/pad/record/handover',
		method: 'DELETE',
		params: {
			'childId': childId,
			'id': id,
		}
	})
}
//交接详情
export const getHandover = (childId, id) => {
	return http.request({
		url: '/pad/record/handover',
		method: 'GET',
		params: {
			'childId': childId,
			'id': id,
		}
	})
}
//大小便
export const getPottyList = (childId, daily) => {
	return http.request({
		url: '/pad/record/potty/daily_records',
		method: 'GET',
		params: {
			'childId': childId,
			'daily': daily,
		}
	})
}

//体温删除
export const delTemperature = (childId, id) => {
	return http.request({
		url: '/pad/record/temperature',
		method: 'DELETE',
		params: {
			'childId': childId,
			'id': id,
		}
	})
}
//喂食删除
export const delFeeding = (childId, id) => {
	return http.request({
		url: '/pad/record/feeding',
		method: 'DELETE',
		params: {
			'childId': childId,
			'id': id,
		}
	})
}

//大小便删除
export const delPotty = (childId, id) => {
	return http.request({
		url: '/pad/record/potty',
		method: 'DELETE',
		params: {
			'childId': childId,
			'id': id,
		}
	})
}

//睡眠删除
export const delSleep = (childId, id) => {
	return http.request({
		url: '/pad/record/sleep',
		method: 'DELETE',
		params: {
			'childId': childId,
			'id': id,
		}
	})
}

export const getRecordFeedByTch = (params) => {
	return http.request({
		url: '/v2/delegation/feed/list',
		method: 'GET',
		params: params
	})
}

export const updateRecordFeed = (params) => {
	return http.request({
		url: '/v2/delegation/feed',
		method: 'POST',
		params: params
	})
}

export const getMedicationList = (childId, daily) => {
	return http.request({
		url: '/pad/record/medication/daily_records',
		method: 'GET',
		params: {
			'childId': childId,
			'daily': daily,
		}
	})
}

//家长
//体温查询
export const getTemperatureListP = (childId, daily) => {
	return http.request({
		url: '/web/record/temperature/daily_records',
		method: 'GET',
		params: {
			'childId': childId,
			'daily': daily,
		}
	})
}
//饮食
export const getFeedingListP = (childId, daily) => {
	return http.request({
		url: '/web/record/feeding/daily_records',
		method: 'GET',
		params: {
			'childId': childId,
			'daily': daily,
		}
	})
}
//睡眠
export const getSleepListP = (childId, daily) => {
	return http.request({
		url: '/web/record/sleep/daily_records',
		method: 'GET',
		params: {
			'childId': childId,
			'daily': daily,
		}
	})
}
//药品交接
export const getHandoverListP = (childId, daily) => {
	return http.request({
		url: '/web/record/handover/daily_records',
		method: 'GET',
		params: {
			'childId': childId,
			'daily': daily,
		}
	})
}
//大小便
export const getPottyListP = (childId, daily) => {
	return http.request({
		url: '/web/record/potty/daily_records',
		method: 'GET',
		params: {
			'childId': childId,
			'daily': daily,
		}
	})
}

// 喂药
export const getMedicationListP = (childId, daily) => {
	return http.request({
		url: '/web/record/medication/daily_records',
		method: 'GET',
		params: {
			'childId': childId,
			'daily': daily,
		}
	})
}

export const getRecordFeed = (params) => {
	return http.request({
		url: '/v2/delegation/feed/list',
		method: 'GET',
		params: params
	})
}


export const addRecordFeed = (params) => {
	return http.request({
		url: '/v2/delegation/feed',
		method: 'POST',
		params: params
	})
}

export const addRecordHandoverByParent = (param) => {
	return http.request({
		url: '/web/record/handover',
		method: 'POST',
		data: param
	})
}

export const getHandoverByParent = (params) => {
	return http.request({
		url: '/web/record/handover/list',
		method: 'GET',
		params
	})
}
export const getDailyReport = (params) => {
	return http.request({
		url: '/web/record/daily/report',
		method: 'GET',
		params
	})
}


/**
 * 更多
 */
export const addMoreList = (params) => {
	return http.request({
		url: '/pad/record/more',
		method: 'POST',
		params
	})
}

/**
 * 更多查询
 */
export const getMoreList = (childId, daily) => {
	return http.request({
		url: '/pad/record/more/daily_records',
		method: 'GET',
		params: {
			'childId': childId,
			'daily': daily,
		}
	})
}

/**
 * 更多查询
 */
export const getAppMoreList = (childId, daily) => {
	return http.request({
		url: '/web/record/more/daily_records',
		method: 'GET',
		params: {
			'childId': childId,
			'daily': daily,
		}
	})
}

/**
 * 详情
 */
export const getMoreListInfo = params => {
	return http.request({
		url: '/pad/record/more',
		method: 'GET',
		params: params
	})
}

/**
 * 更多删除
 */
export const deleteMoreList = (childId, id) => {
	return http.request({
		url: '/pad/record/more',
		method: 'DELETE',
		params: {
			'childId': childId,
			'id': id,
		}
	})
}